package com.palnar.ilecker.adapter;

import java.util.ArrayList;

import com.palnar.ilecker.R;
import com.palnar.ilecker.model.MenuListModel;

import android.content.Context;
import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class MenuListAdapter extends BaseAdapter {

	 private static ArrayList<MenuListModel> itemDetailsrrayList;

	LayoutInflater layoutInflator;
	String[] countryName;
	int[] countryFlag;
	Context context;
	int color;

	
	 public MenuListAdapter(ArrayList<MenuListModel> result , Context c,int color) {
	 // TODO Auto-generated constructor stub 
		 this.color=color;
		 itemDetailsrrayList = result;
	 context = c; }
	

	public int getCount() {
		// TODO Auto-generated method stub
		return  itemDetailsrrayList .size();
	}

	public Object getItem(int arg0) {
		// TODO Auto-generated method stub
		return  itemDetailsrrayList .get(arg0);
	}

	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub

		layoutInflator = (LayoutInflater) context
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View row = layoutInflator.inflate(R.layout.simplelist_menuitems, parent, false);

		TextView textview = (TextView) row.findViewById(R.id.txtName);
		ImageView imageview = (ImageView) row.findViewById(R.id.imgIcon);

		textview.setText(itemDetailsrrayList.get(position).getName());
		textview.setTextColor(color);
		imageview.setImageResource(itemDetailsrrayList.get(position).getResourceImage());

		return (row);
	}
}
